package com.sky.controller.admin;

import com.sky.constant.RedisConstant;
import com.sky.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/admin/shop")
@RestController
public class ShopController {
    @Autowired
    StringRedisTemplate stringRedisTemplate;
    @PutMapping("/{status}")
    public Result status(@PathVariable String status){
        stringRedisTemplate.opsForValue().set(RedisConstant.SHOP_STATUS,status);
        return Result.success();
    }
    @GetMapping("/status")
    public Result getStatus(){
        String s = stringRedisTemplate.opsForValue().get(RedisConstant.SHOP_STATUS);
        Integer i = Integer.parseInt(s);
        return Result.success(i);
    }



}
